<template>
<div>
    <h1>{{msg}}</h1>
    <h2>学校名称:{{name}}</h2>
    <h2>学校地址:{{address}}</h2>
</div>
</template>
<script>

export default {
name:'SchoolN',
  data() {
    return {
        msg:'欢迎来到学校',
        name: '金陵科技学院',
        address:'江宁区',
    }
  },
  mounted(){
    console.log(this.x)
    this.$bus.$on('hello',(data)=>{
      console.log('school收到了数据',data)
    })
  },
  beforeDestroy(){
    //当这个school销毁的时候一定要把bus上面的hello删掉不然会堆积起来
    this.$bus.$off('hello')
  }
}
</script>

<style scoped>
.demo{
  background: orange;
}
</style>